<template>
  <div>
          <h1>This is an Login page</h1>
    <input type="text" name="" id="" v-model="username" placeholder="请输入昵称" />
    <button @click="handelEntry">进入</button>
  </div>
</template>

<script setup lang="ts">
import { ref } from 'vue';
import { useRouter } from 'vue-router';
const router = useRouter()
const username = ref('')
const handelEntry = () => {

      console.log(username.value)
      if (username.value != '') {
        localStorage.setItem('username', username.value)
        router.push('/chat')
      } else {
        alert('请输入昵称')
      }
}
</script>

<style scoped>

</style>